<?php

    

	require("main.php");	

	include(INC_DIR."header.php");		

//echo 'here1';

	

//echo 'top';

//echo INC_DIR;



try {

	//echo 'abcdef'.$_SESSION['uid'];

	//echo '<br>'.session_id().'sessionid<br>';

//echo 'abc';

 $uid = $_POST['uid'];
 $pwd = $_POST['pwd'];
 
 if ($uid != null) {
    $_SESSION['uid'] = $uid;
 } 
 else
  {
     $uid =  $_SESSION['uid'];
  }
 
 if ($pwd != null) {
     $_SESSION['pwd'] = $pwd;
 } else
 {
     $pwd =  $_SESSION['pwd'];
  }
   
   

//echo 'e';

	//db_connect();

		include('dbcon.php');

		if (!$con)

		{

			die('Could not connect: ' . mysql_error());

		}

		//echo 'about to insert';

		mysql_select_db(MYSQLDB, $con);	

	//echo $uid;

	//echo $uid;

	$res = mysql_query("SELECT * FROM users WHERE uid='$uid' AND pwd='$pwd' and status='active'") or die(mysql_error()); 

	//echo $uid.'stuffs<br>';

	//session_write_close(); 

	//echo $re['uid'].'herestuff';

//echo '00000000here'.$re;

    if(mysql_num_rows($res) > 0) {

	$re  = mysql_fetch_array($res) or die(mysql_error()); 

	$_SESSION['uid'] = $re['uid'];

	$_POST["uid"] = $_SESSION['uid'];

	$_SESSION['userID'] = $re['id'];

	  //include(INC_DIR."header.php");

//echos '<br>logged in<br>';


    //  echo "<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>";
    
      echo "<br/> <br/>";
      include("membership4.php");



	} else {

    unset($_SESSION['uid']);

    unset($_SESSION['pwd']);


    
	//echo '------';

	//echo BASEHREF;

	include(INC_DIR."header.php");

   echo "<br/> <br/>";
   
	include(INC_DIR."login.php");

   if ($uid != null )
      echo "<div align='center' style='position:absolute;top:350px;color:red;text-align:center;width:100%'> <br><b>Login Failed. </b> Try Again!</div>";


	}





	include(INC_DIR."footer.php");

}

	catch (Exception $e) 

	{

		echo 'Caught exception: ',  var_dump($e->getMessage()), "\n";

	}


//last stuff:

//echo 'laststuff'.$_SESSION['timeline'];





?>


















































